# -*- coding:utf-8 -*-

import os

def load_stopwords():
    file_path = "./scripts/stop_word/stopwords"
    items = os.listdir(file_path)
    stopwords = []
    for item in items:
        if 'txt' in item:
            with open(os.path.join(file_path, item), 'r', encoding='utf-8') as f:
                stopwords.extend(list(set(f.read().strip().split())))
    return stopwords

def remove_stopwords(words, stopwords):
    return [word for word in words if word not in stopwords]


if __name__ == '__main__':
    load_stopwords()